package de.fhd.pms.model;

import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * The java bean class for {@link Auto} objects.
 * It specifies:
 * <ul>
 * <li>the {@link Auto} class & interfaces</li>
 * <li>get-/set-methods</li>
 * <li>constructors</li>
 * <li>other methods if needed</li>
 * </ul>
 * 
 * @author Fischer, Neetzel & Six
 */
@Entity
@Table(name = "tbl_auto")
public class Auto {
	@Id
	@GeneratedValue
	@Column(name = "pk_auto")
	private Integer id;
	private Date created;
	@Column(name = "marke")
	private String marke;
	@Column(name = "modell")
	private String modell;
	@Column(name = "typ")
	private String tarif;
	@Column(name = "km")
	private float km;
	@Column(name = "baujahr")
	private String baujahr;
	@Column(name = "farbe")
	private String farbe;
	@Column(name = "kennzeichen")
	private String kennzeichen;
	@ManyToOne
	@JoinColumn(name = "fk_station", nullable = true)
	private Station station;

	public Auto() {
	}
	
	//neu für AutoDaoTest
	public Auto(String n) {
		marke = n;
		modell = "";
		tarif = "";
		km = 0;
		baujahr = "";
		farbe = "";
		kennzeichen = "";
		
	}

	@Override
	public boolean equals(Object o) {
		return id == ((Auto) o).getId();
	}

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Date getCreated() {
		return created;
	}

	public void setCreated(Date created) {
		this.created = created;
	}

	public String getMarke() {
		return marke;
	}

	public void setMarke(String marke) {
		this.marke = marke;
	}

	public String getModell() {
		return modell;
	}

	public void setModell(String modell) {
		this.modell = modell;
	}

	public String getTarif() {
		return tarif;
	}

	public void setTarif(String tarif) {
		this.tarif = tarif;
	}

	public float getKm() {
		return km;
	}

	public void setKm(float km) {
		this.km = km;
	}

	public String getBaujahr() {
		return baujahr;
	}

	public void setBaujahr(String baujahr) {
		this.baujahr = baujahr;
	}

	public String getFarbe() {
		return farbe;
	}

	public void setFarbe(String farbe) {
		this.farbe = farbe;
	}

	public String getKennzeichen() {
		return kennzeichen;
	}

	public void setKennzeichen(String kennzeichen) {
		this.kennzeichen = kennzeichen;
	}

	public Station getStation() {
		return station;
	}

	public void setStation(Station station) {
		this.station = station;
	}
}
